/* Author : Putri Andita R
 * 		    091511059
 * Proyek 4*/


package jtk.project4.fleet.field;

import javax.swing.SortOrder;

import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.TableField;
import nl.coderight.jazz.form.field.TableField.AutoResizeMode;


public class TableScheduleField extends GroupControl{
	
	private TableField<String>  scheduleTable;
	
	public TableScheduleField(String bindID){
		setBindID(bindID);
		createFields();
		createLayout();
	}	
	
	private void createFields() {
		//setup table
		scheduleTable = new TableField<String>("schedules","schedule");
		scheduleTable.setTitle("headerscheduleTable");
		scheduleTable.setAutoResizeMode(AutoResizeMode.OFF);
		scheduleTable.getSelectionValues();
		
		//add columns
		scheduleTable.addColumn("label.task","task");
		//scheduleTable.addColumn("label.enable","enable");
		scheduleTable.addColumn("label.type","type");
		scheduleTable.addColumn("label.priority","priority");
		scheduleTable.addColumn("label.dateInterval","dateInterval");
		scheduleTable.addColumn("label.fixedExpireDate","fixedExpireDate");
		scheduleTable.addColumn("label.advancedNotifyDays","advancedNotifyDays");
		scheduleTable.addColumn("label.mileageInterval","mileageInterval");
		scheduleTable.addColumn("label.fixedExpireMileage","fixedExpireMileage");
		scheduleTable.addColumn("label.advancedNotificationMileage","advancedNotificationMileage");
		scheduleTable.addColumn("label.hoursInterval","hoursInterval");
		scheduleTable.addColumn("label.fixedExpireHours","fixedExpireHours");
		scheduleTable.addColumn("label.advancedNotificationHours","advancedNotificationHours");
		scheduleTable.addColumn("label.linkedService","linkedService");
		
		//Sort
		scheduleTable.sort("task", SortOrder.ASCENDING);
	}
	
	private void createLayout() {
		// TODO Auto-generated method stub
		addField(createFieldGroup(),CENTER);
	}
	
	
	private GroupControl createFieldGroup(){
		GroupControl fieldGroup=new GroupControl();
		fieldGroup.addField(scheduleTable,CENTER);
		return fieldGroup;
	}	
}
